package com.gmzg.gmzgoffice;

import android.app.Application;

import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMOptions;
import com.hyphenate.easeui.controller.EaseUI;

import java.text.SimpleDateFormat;
import java.util.Date;

import cn.bmob.v3.Bmob;

/**
 * Created by EdwardGu on 2016/11/8.
 */

public class GMZGApplication extends Application {
    private String userName;

    //打卡按钮状态
    private boolean btnStartWork;
    private boolean btnEndWork;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Override
    public void onCreate() {
        super.onCreate();

        // 环信初始化
        EMOptions options = new EMOptions();
        options.setAcceptInvitationAlways(true); // 好友添加不需要验证
        EMClient emClient = EMClient.getInstance();
        emClient.init(this, options);

        // 初始化 EaseUI 必须要调用
        EaseUI.getInstance().init(this, options);
        //在做打包混淆时，关闭debug模式，避免消耗不必要的资源
        if (BuildConfig.DEBUG) {
            emClient.setDebugMode(true);
        }

        Bmob.initialize(this, "18339e37fbd7c177d16f1204ccc849a3");

        //打卡按钮状态
        long currentTimeMillis = System.currentTimeMillis();
        Date date = new Date(currentTimeMillis);
        SimpleDateFormat hh = new SimpleDateFormat("HH");
        String format = hh.format(date);
        int currentH = Integer.parseInt(format);
        //每天早上服务器对按钮的状态进行更新，设置为可以点击
//        if (currentH<7){
//
//        }
    }
}
